/**
 * 
 */
package com.demo2do.boyle.backend.service.aduser.impl;

import java.util.Collections;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo2do.boyle.backend.service.aduser.AduserLevelService;
import com.demo2do.boyle.common.entity.aduser.AduserLevel;
import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.core.service.impl.GenericServiceImpl;

/**
 * @author Leo
 *
 */
@Service("aduserLevelService")
public class AduserLevelServiceImpl extends GenericServiceImpl<AduserLevel> implements AduserLevelService {

	@Autowired 
	private GenericDaoSupport genericDaoSupport;
	
	/*
     * (non-Javadoc)
     * @see com.demo2do.boyle.backend.service.AduserLevelService#list(com.demo2do.core.web.resolver.Page)
     */
	@SuppressWarnings("unchecked")
	public void primary(AduserLevel aduserLevel) {
		
		genericDaoSupport.executeHQL("UPDATE AduserLevel SET primary = false", Collections.EMPTY_MAP);
		
		genericDaoSupport.update(aduserLevel.primary());
		
	}
}
